<?php
//设置编码
header('Content-type:text/html;charset=utf-8');

//开启session
session_start();

//包含网站配置
include '../../public/wzpeizhi.php';

//包含数据库配置
include '../../public/peizhi.php';

//包含函数
include '../../public/func.php';

if(!isset($_SESSION['uname'])){
	header('location:./shouye.php');
}

//调用函数连接数据库
$link = db();

//包含HTML第一部分
include '../public/header2.php';
?>
<!DOCTYPE html>
<html>
	
	<!-- 头部包含外部样式 -->
	<head>
		<meta charset="utf-8">
		<title><?php echo WZ_NAME;?></title>
		<meta name="keywords" content="<?php echo WZ_KEY;?>">
		<meta name="description" content="最大的社区网站">
		<link href="../css/geren.css" rel="stylesheet">
	</head>
	<!-- 头部结束 -------------------->
	
	<body>
			
			<!-- 第二部分b盒子,包含 b1,b2两个盒子 -->
			<div id="b">
			
				<b><div id="b1">
					<img src="../tupian/887643d2.bmp.bmp">
					&gt; <a href="">设置</a>
					&gt; <a href="">个人资料</a>
				</div></b>
				
<?php
			//查询用户
			$sql = "select * from user where id={$_SESSION['uid']}";

			//执行SQL语句
			$res = mysqli_query($link,$sql);
			
			//获取分区结果
			if($res && mysqli_num_rows($res)){
				$user = mysqli_fetch_assoc($res);
			}
?>				
				<div id="b2">
					<form method="post" action="../dogeren.php" enctype="multipart/form-data">
					<input type="hidden" name="uid" value="<?php echo $user['id'];?>">
					<input type="hidden" name="oldpic" value="<?php echo $user['pic'];?>">
						<h3>个人资料</h3>
				用户名:		<b><?php echo $user['name'];?></b><br><br>
				性别:		<input type="radio" name="sex" value="1" <?php echo $user['sex'] == 1 ? 'checked' : '' ;?>>男
							<input type="radio" name="sex" value="2" <?php echo $user['sex'] == 2 ? 'checked' : '' ;?>>女
							<input type="radio" name="sex" value="3" <?php echo $user['sex'] == 3 ? 'checked' : '' ;?>>保密
							<br><br>
				年龄:		<input type="text" name="age" value="<?php echo $user['age'];?>"><br><br>			
				邮箱:	<input type="email" name="email" value="<?php echo $user['email'];?>"><br><br>
				头像:	<input type="file" name="pic"><img src="../../uploads/<?php echo $user['pic'];?>"><br><br><br>
							<input type="submit" name="queding" value="保存">
					</form>
				</div>
				
			</div>
			<!-- 第二部分b盒子结束 ----------------->
			
			<div id="H"><h3><a href="./shouye.php">不想修改,返回首页</a></h3></div>
<?php
//释放结果
mysqli_free_result($res);

//包含页脚
include '../public/footer.php';
?>
	</body>
</html>